#pragma once
#include "Position.h"
#include "color.h"
#include "Texture.h"
#include "Element.h"
#include "Drawable.h"
#include <list>

class TriangularObstacle : public Element, public Drawable {

public:
	TriangularObstacle( Position * p1, Position * p2, Position * p3 );
	TriangularObstacle(void);
	~TriangularObstacle(void);
	void setP1(Position * p1);
	void setP2(Position * p1);
	void setP3(Position * p1);
	Position * getP1(void);
	Position * getP2(void);
	Position * getP3(void);
	int include(Position * point);

	virtual void setPosition(Position *position);
	virtual Position * getPosition();
	virtual Color * getElementColor();
	virtual void setElementColor( Color * color);
	virtual Color * getLineColor();
	virtual void setLineColor( Color * color);
	virtual Texture * getTexture();
	virtual void setTexture(Texture *texture);
	virtual void draw();
	virtual float getMinXPos();	//Para utilizar los siguientes metodos, la posicion debera estar ya seteada sino, devolvera 0
	virtual float getMinYPos();
	virtual float getMaxXPos();
	virtual float getMaxYPos();

private:
	Position * p1;
	Position * p2;
	Position * p3;

	float m1,m2,m3;
	float ord1,ord2,ord3;
	int getPointEdge1_2(Position * p);
	int getPointEdge1_3(Position * p);
	int getPointEdge2_3(Position * p);
	int fx(int x, float m, float o);

	Position * position;
	Texture * texture;
	Color * elementColor;
	Color * lineColor;

public:	
	
};
